"""ops_platform URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from rest_framework import routers

from apps.system import views as systemviews
from apps.resource import views as resourceviews
from apps.cicd import views as cicdviews
from apps.eff import views as effviews


router = routers.DefaultRouter()
router.register(r'wxlogin', systemviews.WxLoginViewSet, basename='api-wxlogin')
router.register(r'logout', systemviews.LogoutViewSet, basename='api-logout')
router.register(r'role', systemviews.RoleViewSet, basename='api-role')
router.register(r'menu/tree', systemviews.MenuTreeViewSet, basename='api-menu-tree')
router.register(r'menu', systemviews.MenuViewSet, basename='api-menu')
router.register(r'user', systemviews.UserViewSet, basename='api-user')
router.register(r'config', systemviews.ConfigViewSet, basename='api-config')

router.register(r'res/lob/business', resourceviews.BusinessViewSet, basename='api-business')
router.register(r'res/lob/perm', resourceviews.LobPermViewSet, basename='api-perm')
router.register(r'res/lob/project', resourceviews.ProjectViewSet, basename='api-project')
router.register(r'res/lob/service', resourceviews.ServiceViewSet, basename='api-service')
router.register(r'res/kube', resourceviews.KubernetesViewSet, basename='api-kube')
router.register(r'res/repo', resourceviews.DockerRepoViewSet, basename='api-reg')
router.register(r'res/env', resourceviews.EnvironmentViewSet, basename='api-env')

router.register(r'cicd/setting/capacity', cicdviews.CapacityViewSet, basename='api-capacity')
router.register(r'cicd/setting/yamltemplate', cicdviews.YAMLTemplateViewSet, basename='api-yaml-template')
router.register(r'cicd/setting/lob/business', cicdviews.BusinessEnvSettingViewSet, basename='api-business-env-setting')
router.register(r'cicd/setting/lob/project', cicdviews.ProjectEnvSettingViewSet, basename='api-project-env-setting')
router.register(r'cicd/setting/lob/service', cicdviews.ServiceEnvSettingViewSet, basename='api-service-env-setting')
router.register(r'cicd/setting/lob', cicdviews.LobEnvSettingViewSet, basename='api-lob-env-setting')
router.register(r'cicd/setting/lobyaml', cicdviews.LobYamlSettingViewSet, basename='api-lob-yaml-setting')
router.register(r'cicd/workorder', cicdviews.WorkOrderViewSet, basename='api-workorder')
router.register(r'cicd/updatetype', cicdviews.UpdateTypeViewSet, basename='api-update-type')
router.register(r'cicd/flow', cicdviews.FlowViewSet, basename='api-flow')
# router.register(r'cicd/stage', cicdviews.StageViewSet, basename='api-stage')
# router.register(r'cicd/flowstage', cicdviews.FlowStageViewSet, basename='api-flow-stage')
# router.register(r'cicd/stagestep', cicdviews.StageStepViewSet, basename='api-stage-step')
router.register(r'cicd/workorderstep', cicdviews.WorkOrderStepViewSet, basename='api-workorder-step')
router.register(r'cicd/demandorder', cicdviews.DemandOrderViewSet, basename='api-workorder-demand-order')

### 能效
router.register(r'eff/gitlab/commithistory', effviews.GitCommitViewSet, basename='api-eff-gitcommit-history')
router.register(r'eff/gitlab/commitstat', effviews.GitCommitDayStatViewSet, basename='api-eff-gitcommit-day-stat')
router.register(r'eff/tapd', effviews.TapdViewSet, basename='api-eff-tapd')
router.register(r'eff/imagediff', effviews.ImageDiffViewSet, basename='api-eff-imagediff')
router.register(r'eff/proxy', effviews.ProxyRequestViewSet, basename='api-eff-proxy-request')

urlpatterns = [
    path('api/', include(router.urls)),
    path('admin/', admin.site.urls),
    path('wxlogin/', systemviews.wxlogin, name='wxlogin'),
    path('', systemviews.main, name='index'),
]

#ohSoKEozbjG8fczG20VP6xnqWQdDOFPZxYrOWIW-fuw